Documentation > CMS Template API Library > Asset > GetSystemHistory(Nullable[DateTime],Nullable[DateTime],String,Int32,AuditAction,Int32,Int32)

GetSystemHistory

Returns a list of system audit entries based on the parameters in the request

public List<AuditData> GetSystemHistory(Nullable[DateTime],Nullable[DateTime],String,Int32,AuditAction,Int32,Int32)


Returns

A list of system audit entries.

Parameters

NameDescriptionType
startDate The start date to filter on. Nullable<DateTime>
endDate The end date to filter on. Nullable<DateTime>
Label Filter audit by label. Use an empty string "" to filter all assets. System.String
CreateUserId Filter by user who created the asset. System.Int32
actionId Filter by action. CrownPeak.CMSAPI.AuditAction
assetId Filter by asset ID. Use 0 to filter all assets. System.Int32
currentPage The page of data to return. 50 items per page. System.Int32

Code Example

C#

Sample:
Nullable<DateTime> startDate = new Nullable<DateTime>(new DateTime(2015, 12, 1));
Nullable<DateTime> endDate = new Nullable<DateTime>(new DateTime(2019, 12, 25));

//string label = "Test";
string label = ""; // Filter all assets

int CreateUserId = context.UserInfo.Id;

AuditAction action = AuditAction.ActionBrowse;
//AuditAction action = AuditAction.ActionLogin;

//int assetId = 27420;
int assetId = 0; // Filter all assets

List<AuditData> audit = Asset.GetSystemHistory(startDate, endDate, label, CreateUserId, action, assetId, 1);

foreach(AuditData a in audit)
{
  Out.WriteLine("Action: " + a.Action + ", ActionId: " + a.ActionId + ", AssetId: " + a.AssetId + ", AssetIsDeleted: " + a.AssetIsDeleted.ToString() + ", Date: " + a.Date.ToString() + ", Description: " + a.Description + ", Label: " + a.Label + ", User: " + a.User + "<br />");
}

Connect with Crownpeak